import React, { Dispatch } from 'react';

/**
 * 上下文标识类型
 * */
export interface IUpdateContext {
  curRes: Record<string, any>;
  dispatch: Dispatch<any>;
  projectInfo: Record<string, any>;
  SourceInfo: Record<string, any>;
  prefixCls: String;
  Source_Invite: Record<string, any>;
  locationProps: Record<string, any>;
  Invite_PackList: Record<string, any>[];
  Calibrate_Id: string;
  Source_Clarify: Record<string, any>;
  Source_PurchaseChange: Record<string, any>;
  Source_Calibrate: Record<string, any>;
  Source_CurrentStep: number;
}

/**
 * 初始化上下文
 * */
const init_update_context: IUpdateContext = {
  curRes: {},
  dispatch: () => {},
  prefixCls: 'source-manage-',
  projectInfo: {},
  SourceInfo: {},
  Source_Invite: {},
  locationProps: {},
  Invite_PackList: [],
  Calibrate_Id: '',
  Source_Clarify: {},
  Source_PurchaseChange: {},
  Source_Calibrate: {},
  Source_CurrentStep: 0,
};

/**
 * 创建上下文  寻源管理-新增编辑页
 * */
const SourceUpdateContext = React.createContext(init_update_context);

/**
 * 导出
 * */
export { SourceUpdateContext };
